
class Dictionary {
    constructor() {
        this.dataStore = new Map()
    }
    add(key, v) {
        this.dataStore.set(key, v)
    }
    find(key) {
        return this.dataStore.get(key)
    }
    remove(key) {
        return this.dataStore.delete(key)
    }
    count() {
        return this.dataStore.size
    }
    clear() {
        this.dataStore = new Map()
    }
    
    showAll() {
        let arr = []
        for (let key of this.dataStore.keys()) {
            arr.push({ key, value: this.dataStore.get(key) })
        }
        return arr
    }

}

module.exports = Dictionary